package com.xique.park.controller.web;

import com.alibaba.fastjson.JSONObject;
import com.xique.common.core.web.controller.BaseController;
import com.xique.common.core.web.domain.AjaxResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: xq-cloud
 * @ClassName WebParkInvoiceController
 * @description:
 * @author: HdongSun
 * @create: 2022-09-07 15:23
 **/
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/web/invoice")
@Slf4j
public class WebParkInvoiceController extends BaseController {

//    @GetMapping("/test")
//    public AjaxResult test() {
//        try {
//            Sdk sdk = new Sdk("EgDjckWzyGxwIi7e9J1A8LdruWMidFFH", "9Q8744Oe0nv8aw738b3HkjdylYZzNeZOcTz53KI4pchKpqIi", "test");
//            //Sdk sdk = new Sdk("fc1234561483b2db498", "a1c1234c5af678bc42d322a7gtrty4565", "test");
//            JSONObject result = invoiceBlue(sdk);
//            //JSONObject result = invoiceRed(sdk);
//            System.out.println(result);
//        } catch (IOException e) {
//            e.printStackTrace();
//        }catch (Exception e) {
//            e.printStackTrace();
//        }
//        return null;
//    }

    @PostMapping("/notify")
    public AjaxResult invoice(@RequestBody JSONObject json) {
        log.info("goldencloud开票结果回调：{}", json);
        return AjaxResult.success();
    }

}
